package com.ys.bean.support;

import com.ys.exception.BeanDefinitionStoreException;
import com.ys.exception.NoSuchFileException;
import com.ys.io.Resource;
import com.ys.io.ResourceLoader;

/**
 * <p>@description:从配置文件种读取BeanDefinition</p>
 *
 * @projectName: Spring-Mini
 * @packageName: com.com.ys.bean.support
 * @className:
 * @author: shuangyang
 * @date: 1/14/17 11:00 PM
 */
public interface BeanDefinitionReader {
    /**
     * 通过配置文件加载beanDefinitions
     *
     * @param location
     * @throws NoSuchFileException
     */
  /*  void loadBeanDefinitions(String location) throws NoSuchFileException, IOException, ParserConfigurationException;
*/
    /**
     * Return the bean factory to register the bean definitions with.
     * @return
     */
    BeanDefinitionRegistry getRegistry();

    /**
     *Return the Resource loader to use for resource locations.
     * @return
     */
    ResourceLoader getResourceLoader();

    /**
     * Load bean definitions from the specified resource.
     * @param resource
     * @return
     * @throws BeanDefinitionStoreException
     */
    int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException;

    /**
     * Load bean definitions from the specified resources.
     * @param resources
     * @return
     * @throws BeanDefinitionStoreException
     */
    int loadBeanDefinitions(Resource... resources) throws BeanDefinitionStoreException;

    /**
     * load bean definitions from the specified resource location;
     * @param location the resource location,to be loaded with ResourceLoader
     * @return
     * @throws BeanDefinitionStoreException
     */
    int loadBeanDefinitions(String location) throws BeanDefinitionStoreException;

    /**
     * load bean definitions from the specified resource locations;
     * @param location the resource location,to be loaded with ResourceLoader
     * @return
     * @throws BeanDefinitionStoreException
     */
    int loadBeanDefinitions(String... locations) throws BeanDefinitionStoreException;
}
